#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Window/Keyboard.hpp>
#include "draw.h"

/*
wasd - norm
q down
e up
ctrl o for lots of objects
just o for objects
*/

using namespace std;

int main() {
    sf::Window window(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, FPS), "Windowname", sf::Style::Default | sf::Style::Fullscreen, sf::ContextSettings(32));
    window.setKeyRepeatEnabled(false);
    window.setMouseCursorVisible(false);
    sf::Mouse::setPosition(sf::Vector2i(SCREEN_WIDTH, SCREEN_HEIGHT), window);

    draw::init();
    void update_init();
    update_init();

    while (window.isOpen()) {
        //Handle events
        sf::Event event;
        while (window.pollEvent(event)) {
            void handle_key(sf::Event::KeyEvent, bool pressed);
            void handle_mouse(sf::Event::MouseMoveEvent);

			if (event.type == sf::Event::KeyPressed) {
			    if (event.key.code == sf::Keyboard::Escape)
				    window.close();
                else
                    handle_key(event.key, true);
            }

            if (event.type == sf::Event::KeyReleased)
                handle_key(event.key, false);


            if (event.type == sf::Event::MouseMoved) {
                handle_mouse(event.mouseMove);
            }
        }
        sf::Mouse::setPosition(sf::Vector2i(500, 500), window);

        void update();
        update();

        //Draw the GL frame
        draw::draw();

        //Display the buffer
        window.display();
    }

    return 0;
}
